//
//  BaseAdapter.m
//  ccZone
//
//  Created by 陈小娟 on 2017/12/15.
//  Copyright © 2017年 CC. All rights reserved.
//

#import "BaseAdapter.h"

@implementation BaseAdapter

//实现代理方法(实现协议)
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 10;
}

-(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    //父类默认Cell
    BaseCell *cell = [tableView dequeueReusableCellWithIdentifier:BaseCellID];
    cell.textLabel.text = [NSString stringWithFormat:@"(section,row):(%ld,%ld)",indexPath.section,indexPath.row];
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
    if (_delegate && [_delegate respondsToSelector:@selector(selectCellatRow:atSection:)]) {
        [_delegate selectCellatRow:indexPath.row atSection:indexPath.section];
    }
}

-(NSMutableArray *)dataArray {
    if (!_dataArray) {
        _dataArray = [NSMutableArray array];
    }
    return _dataArray;
}


@end
